package com.schedule.queue;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class ScheduleTest {

    public static void main(String[] args) throws InterruptedException {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss SSS");
        ScheduleService scheduleService = new ScheduleService();
        scheduleService.schedule(()->{
            System.out.println(LocalDateTime.now().format(dateTimeFormatter) +  "this is 100ms task");
        },100);

        Thread.sleep(1000);
        System.out.println("加入一个每200ms执行一次的定时任务");
        scheduleService.schedule(()->{
            System.out.println(LocalDateTime.now().format(dateTimeFormatter) +  "this is 200ms task");
        },200);
    }
}
